#ifndef _ATAGEPANEL_H
#define _ATAGEPANEL_H

#include "AtAgePanel.h"

AtAgePanel::AtAgePanel(wxWindow* parent,
                       wxString  panelLabel,
                       int    lowPerc,
                       int    highPerc,
                       int    lowVal,
                       int    highVal)
          : wxPanel(parent, wxID_ANY)
{
  m_pLowPerc    = lowPerc;
  m_pHighPerc   = highPerc;
  m_pLowVal     = lowVal;
  m_pHighVal    = highVal;

  m_pVertBoxSizer   = new wxBoxSizer(wxVERTICAL);
  // Add LabelNULL, two textboxes and two statictexts for lower and upper percent limits to the horiz sizer, and fill them
  m_pHorizBoxSizer0 = new wxBoxSizer(wxHORIZONTAL);
  m_pNullLabel      = new wxStaticText(this, wxID_ANY, wxT(NULL_STRING));
  m_pLabelPerc0     = new wxStaticText(this, wxID_ANY, wxT(AT_AGE_DEFAULT_PERC_STRING));
  m_pLabelPerc1     = new wxStaticText(this, wxID_ANY, wxT(AT_AGE_DEFAULT_PERC_STRING));
  m_pTextCtrlPerc0  = new wxTextCtrl(this, wxID_ANY);
  m_pTextCtrlPerc1  = new wxTextCtrl(this, wxID_ANY);
  m_pTextCtrlPerc0->SetValue(wxString::Format(wxT("%i"), m_pLowPerc));
  //m_pTextCtrlPerc0->SetBackgroundColour(wxColour("#000000"));
  m_pTextCtrlPerc1->SetValue(wxString::Format(wxT("%i"), m_pHighPerc));

  m_pHorizBoxSizer0->Add(m_pNullLabel, wxSizerFlags(8).Expand().Center().Border(wxALL,BORDER_SIZE));
  m_pHorizBoxSizer0->Add(m_pTextCtrlPerc0, wxSizerFlags(3).Center().Border(wxALL,BORDER_SIZE));
  m_pHorizBoxSizer0->Add(m_pLabelPerc0, wxSizerFlags(1).Expand().Center().Border(wxALL,BORDER_SIZE));
  m_pHorizBoxSizer0->Add(m_pTextCtrlPerc1, wxSizerFlags(3).Center().Border(wxALL,BORDER_SIZE));
  m_pHorizBoxSizer0->Add(m_pLabelPerc1, wxSizerFlags(1).Expand().Center().Border(wxALL,BORDER_SIZE));

  // Add panel label, two textboxes for upper and lower values to the second horiz sizer, and fill them
  m_pHorizBoxSizer1 = new wxBoxSizer(wxHORIZONTAL);
  m_pPanelLabel = new wxStaticText(this, wxID_ANY, panelLabel);
  m_pTextCtrlVal0   = new wxTextCtrl(this, wxID_ANY);
  m_pTextCtrlVal1   = new wxTextCtrl(this, wxID_ANY);
  m_pTextCtrlVal0->SetValue(wxString::Format(wxT("%i"), m_pLowVal));
  m_pTextCtrlVal1->SetValue(wxString::Format(wxT("%i"), m_pHighVal));
  m_pHorizBoxSizer1->Add(m_pPanelLabel, wxSizerFlags(2).Expand().Center().Border(wxALL,BORDER_SIZE));
  m_pHorizBoxSizer1->Add(m_pTextCtrlVal0, wxSizerFlags(1).Expand().Center().Border(wxALL,BORDER_SIZE));
  m_pHorizBoxSizer1->Add(m_pTextCtrlVal1, wxSizerFlags(1).Expand().Center().Border(wxALL,BORDER_SIZE));

  // Stack the two horiz sizers on top of each other
  m_pStaticBox      = new wxStaticBox(this, wxID_ANY, wxT(NULL_STRING));
  m_pStaticBoxSizer = new wxStaticBoxSizer(m_pStaticBox, wxVERTICAL);
  m_pStaticBoxSizer->Add(m_pHorizBoxSizer0, wxSizerFlags(1).Expand().Center().Border(wxALL,BORDER_SIZE));
  m_pStaticBoxSizer->Add(m_pHorizBoxSizer1, wxSizerFlags(1).Expand().Center().Border(wxALL,BORDER_SIZE));

  m_pVertBoxSizer->Add(m_pStaticBoxSizer, wxSizerFlags(1).Expand().Left().Border(wxALL,BORDER_SIZE));
  SetSizerAndFit(m_pVertBoxSizer);
}

AtAgePanel::~AtAgePanel()
{
}

BEGIN_EVENT_TABLE ( AtAgePanel, wxPanel)

END_EVENT_TABLE()

#endif // _ATAGEPANEL_H
